package fonkin.com.wifisignapp.acticity.aboutMe;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import fonkin.com.wifisignapp.R;
import fonkin.com.wifisignapp.bean.app.AppVersion;
import fonkin.com.wifisignapp.retrofit.BaseRetrofit;
import fonkin.com.wifisignapp.utils.ReturnVo;
import fonkin.com.wifisignapp.utils.ShowToast;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

public class AppVersionActivity extends AppCompatActivity {


    TextView appName,appVersion,appRemark,createTime;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_app_version);
        initView();
    }

    private void initView() {
        appName = (TextView)findViewById(R.id.app_name);
        appVersion= (TextView)findViewById(R.id.app_version);
        appRemark = (TextView)findViewById(R.id.app_remark);
        createTime = (TextView)findViewById(R.id.update_time);
        BaseRetrofit.GetBaseRetrofit().getAppVersion().enqueue(new Callback<ReturnVo<AppVersion>>() {
            @Override
            public void onResponse(Call<ReturnVo<AppVersion>> call, Response<ReturnVo<AppVersion>> response) {
                if (response.isSuccessful()&&response.body().getCode().equals(1)) {
                    AppVersion appVersionInfor = response.body().getData();
                    appName.setText(appVersionInfor.getAppName().toString());
                    appVersion.setText(appVersionInfor.getAppVersion().toString());
                    appRemark.setText(appVersionInfor.getRemark().toString());
                    createTime.setText(appVersionInfor.getCreateTime().toString());
                }
            }

            @Override
            public void onFailure(Call<ReturnVo<AppVersion>> call, Throwable t) {

            }
        });
    }

    public void checkVersion(View v){
        ShowToast.CenterToast("已是最新版本",AppVersionActivity.this);
    }
}
